/*
 * Localq.h
 *
 *  Created on: Aug 2, 2012
 *      Author: koschke
 */

#ifndef LOCALQ_H_
#define LOCALQ_H_

#include "../OrderParameter.h"
#include <gsl/gsl_sf_legendre.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
#include <votca/csg/csgapplication.h>
#include <votca/csg/beadlist.h>
#include <votca/csg/nblist.h>
#include <votca/csg/nblistgrid.h>

using namespace votca::csg;
using namespace votca::tools;

class LocalQ: public OrderParameter {
public:
	LocalQ(Topology * _top, BeadList * _beadList) :
			OrderParameter(_top, _beadList) {
		BeadContainer::iterator ib;
		long int ind = 0;
		for (ib = top->Beads().begin(); ib != top->Beads().end(); ++ib) {
			lq = &(lqVec[ind]);
			lq->nns = 0;
			lq->qlmSumSqrt = 0.0;
			lq->d = 0.0;
			for (int m = 0; m < 13; m++)
				lq->qlm[m] = gsl_complex_rect(0.0, 0.0);
			ind++;
		}
	}
	;

	virtual ~LocalQ();
	void Calculate();
	void PrintInfo();
	void setThreshold(double _threshold);
protected:
	gsl_complex SphHarm(int l_, int m_, vec r_);
	double threshold;
};

#endif /* LOCALQ_H_ */
